package practice;

import private1.Day;

public class AccountPract {
    private String name;
    private String no;
    private long balance;

    private Day opendate;

    private int year;
    private int month;
    private int date;
    {

        System.out.println("感谢您开设中国农业银行的账户。");


    }

    AccountPract(int year,int month,int date){
        this.year=year;
        this.month=month;
        this.date=date;
    }
   AccountPract(String name,String no,long balance,Day opendate){
    //this(year,month,date);
    this.name=name;
    this.no=no;
    this.balance=balance;
    this.opendate=new Day(opendate);
   }


   String getName(){
        return name;
   }
   String getNo(){
        return no;
   }
   long getbalance(){
        return balance;
    }
    Day getOpendate(){
        return new Day(opendate);
    }
//    int getYear(){return year;}
//    int getMonth(){return  month;}
//    int getDate(){return  date;}

    public   int dayOfWeek(){
        //String[] wd={"日","一","二","三","四","五","六","七",};
        int y=year;
        int m=month;
        if (m==1||m==2){
            y--;
            m+=12;
        }
        return (y+y/4-y/100+y/400+(13*m+8)/5+date%7);
    }
    public String toString(){
       String[] wd={"日","一","二","三","四","五","六",};
       return String.format("%04d年%02d月%02d日(%s)\n",
               year,month,date,wd[dayOfWeek()]);

   }

}
